/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author Alex
 */
@Entity
@Table(name = "T03_PROJ_COLUMNS")
@NamedQueries({
    @NamedQuery(name = "ProjColumn.findAll", query = "SELECT p FROM ProjColumn p"),
    @NamedQuery(name = "ProjColumn.findById", query = "SELECT p FROM ProjColumn p WHERE p.id = :id"),
    @NamedQuery(name = "ProjColumn.findByColumnName", query = "SELECT p FROM ProjColumn p WHERE p.columnName = :columnName"),
    @NamedQuery(name = "ProjColumn.findByColumnDescription", query = "SELECT p FROM ProjColumn p WHERE p.columnDescription = :columnDescription"),
    @NamedQuery(name = "ProjColumn.findByColumnId", query = "SELECT p FROM ProjColumn p WHERE p.projId.projId = :projId")
})
public class ProjColumn implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private Long id;
    @Column(name = "COLUMN_NAME")
    private String columnName;
    @Column(name = "COLUMN_DESCRIPTION")
    private String columnDescription;
    @Column(name = "PROJ_ID")
    private Long projectId;

    @JoinColumn(name = "PROJ_ID", referencedColumnName = "PROJ_ID", insertable=false, updatable=false)
    @ManyToOne(optional = false)
    private Project projId;

    public ProjColumn() {
    }

    public ProjColumn(Long id) {
        this.id = id;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public String getColumnDescription() {
        return columnDescription;
    }

    public void setColumnDescription(String columnDescription) {
        this.columnDescription = columnDescription;
    }

    public Project getProjId() {
        return projId;
    }

    public void setProjId(Project projId) {
        this.projId = projId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ProjColumn)) {
            return false;
        }
        ProjColumn other = (ProjColumn) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.ProjColumn[id=" + id + "]";
    }

    /**
     * @return the projectId
     */
    public Long getProjectId() {
        return projectId;
    }

    /**
     * @param projectId the projectId to set
     */
    public void setProjectId(Long projectId) {
        this.projectId = projectId;
    }

}
